import pika

connection = pika.BlockingConnection(pika.ConnectionParameters('localhost'))

channel = connection.channel()

channel.queue_declare(queue='hello')

def callback(ch, method, properties, body):
    print('[x] receive %r' % body)

channel.basic_consume(on_message_callback=callback,
                      queue='hello')
                      # no_ack=True)
print('[*] waiting for messages')

channel.start_consuming()